<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
                      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Zend_Service_Amazon_Ec2: Security Groups - Zend Framework Manual</title>

    <link href="../css/shCore.css" rel="stylesheet" type="text/css" />
    <link href="../css/shThemeDefault.css" rel="stylesheet" type="text/css" />
    <link href="../css/styles.css" media="all" rel="stylesheet" type="text/css" />
</head>
<body>
<h1>Zend Framework</h1>
<h2>Programmer's Reference Guide</h2>
<ul>
    <li><a href="../en/zend.service.amazon.ec2.securitygroups.html">Inglês (English)</a></li>
    <li><a href="../pt-br/zend.service.amazon.ec2.securitygroups.html">Português Brasileiro (Brazilian Portuguese)</a></li>
</ul>
<table width="100%">
    <tr valign="top">
        <td width="85%">
            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.service.amazon.ec2.zones.html">Zend_Service_Amazon_Ec2: Regions and Availability Zones</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.service.html">Zend_Service</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.amazon.s3.html">Zend_Service_Amazon_S3</a></div>
                    </td>
                </tr>
            </table>
<hr />
<div id="zend.service.amazon.ec2.securitygroups" class="section"><div class="info"><h1 class="title">Zend_Service_Amazon_Ec2: Security Groups</h1></div>
    

    <p class="para">
         A security group is a named collection of access rules. These access
         rules specify which ingress (i.e., incoming) network traffic should
         be delivered to your instance. All other ingress traffic will be
         discarded.
    </p>

    <p class="para">
        You can modify rules for a group at any time. The new rules are
        automatically enforced for all running instances and instances
        launched in the future.
    </p>

    <blockquote class="note"><p><b class="note">Note</b>: <span class="info"><b>Maximum Security Groups</b><br /></span>
        

        <p class="para">You can create up to 100 security groups.</p>
    </p></blockquote>

    <div class="section" id="zend.service.amazon.ec2.securitygroups.maintenance"><div class="info"><h1 class="title">Security Group Maintenance</h1></div>
        

        <div class="example" id="zend.service.amazon.ec2.securitygroups.maintenance.create"><div class="info"><p><b>Example #1 Create a new Security Group</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">create</code> a new security group. Every instance is
                launched in a security group. If no security group is specified
                during launch, the instances are launched in the default security
                group. Instances within the same security group have unrestricted
                network access to each other. Instances will reject network access
                attempts from other instances in a different security group.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">create</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;create(&#039;mygroup&#039;, &#039;my group description&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.securitygroups.maintenance.describe"><div class="info"><p><b>Example #2 Describe a Security Group</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">describe</code> returns information about security groups that
                you own.
            </p></div>

            <div class="example-contents"><p>
                If you specify security group names, information about those security
                groups is returned. Otherwise, information for all security groups is
                returned. If you specify a group that does not exist, a fault is returned.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">describe</code> will return an array containing information
                about security groups which includes the ownerId, groupName,
                groupDescription and an array containing all the rules for that security
                group.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;describe(&#039;mygroup&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.securitygroups.maintenance.delete"><div class="info"><p><b>Example #3 Delete a Security Group</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">delete</code> will remove the security group. If you attempt to
                delete a security group that contains instances, a fault is returned.
                If you attempt to delete a security group that is referenced by another
                security group, a fault is returned. For example, if security group B
                has a rule that allows access from security group A, security group A
                cannot be deleted until the allow rule is removed.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">delete</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;delete(&#039;mygroup&#039;);
</pre>

        </div>
    </div>

    <div class="section" id="zend.service.amazon.ec2.securitygroups.authorize"><div class="info"><h1 class="title">Authorizing Access</h1></div>
        

        <div class="example" id="zend.service.amazon.ec2.securitygroups.authorize.ip"><div class="info"><p><b>Example #4 Authorizing by IP</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">authorizeIp</code> Adds permissions to a security group based on
                an IP address, protocol type and port range.
            </p></div>

            <div class="example-contents"><p>
                Permissions are specified by the IP protocol (TCP, UDP or ICMP), the
                source of the request (by IP range or an Amazon EC2 user-group pair),
                the source and destination port ranges (for <acronym class="acronym">TCP</acronym> and UDP), and the
                ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used
                as a wildcard in the type and code fields.
            </p></div>

            <div class="example-contents"><p>
                Permission changes are propagated to instances within the security group
                as quickly as possible. However, depending on the number of instances, a
                small delay might occur.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">authorizeIp</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;authorizeIp(&#039;mygroup&#039;,
                                &#039;protocol&#039;,
                                &#039;fromPort&#039;,
                                &#039;toPort&#039;,
                                &#039;ipRange&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.securitygroups.authorize.group"><div class="info"><p><b>Example #5 Authorize By Group</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">authorizeGroup</code> Adds permissions to a security group.
            </p></div>

            <div class="example-contents"><p>
                Permission changes are propagated to instances within the security group
                as quickly as possible. However, depending on the number of instances, a
                small delay might occur.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">authorizeGroup</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;authorizeGroup(&#039;mygroup&#039;, &#039;securityGroupName&#039;, &#039;ownerId&#039;);
</pre>

        </div>
    </div>

    <div class="section" id="zend.service.amazon.ec2.securitygroups.revoke"><div class="info"><h1 class="title">Revoking Access</h1></div>
        

        <div class="example" id="zend.service.amazon.ec2.securitygroups.revoke.ip"><div class="info"><p><b>Example #6 Revoke by IP</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">revokeIp</code> Revokes permissions to a security group based on
                an IP address, protocol type and port range. The permissions used to revoke
                must be specified using the same values used to grant the permissions.
            </p></div>

            <div class="example-contents"><p>
                Permissions are specified by the IP protocol (TCP, UDP or ICMP), the
                source of the request (by IP range or an Amazon EC2 user-group pair),
                the source and destination port ranges (for <acronym class="acronym">TCP</acronym> and UDP), and the
                ICMP codes and types (for ICMP). When authorizing ICMP, -1 can be used
                as a wildcard in the type and code fields.
            </p></div>

            <div class="example-contents"><p>
                Permission changes are propagated to instances within the security group
                as quickly as possible. However, depending on the number of instances, a
                small delay might occur.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">revokeIp</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;revokeIp(&#039;mygroup&#039;,
                             &#039;protocol&#039;,
                             &#039;fromPort&#039;,
                             &#039;toPort&#039;,
                             &#039;ipRange&#039;);
</pre>

        </div>

        <div class="example" id="zend.service.amazon.ec2.securitygroups.revoke.group"><div class="info"><p><b>Example #7 Revoke By Group</b></p></div>
            

            <div class="example-contents"><p>
                <code class="code">revokeGroup</code> Adds permissions to a security group. The permissions
                to revoke must be specified using the same values used to grant the
                permissions.
            </p></div>

            <div class="example-contents"><p>
                Permission changes are propagated to instances within the security group
                as quickly as possible. However, depending on the number of instances, a
                small delay might occur.
            </p></div>

            <div class="example-contents"><p>
                <code class="code">revokeGroup</code> returns boolean <b><tt>TRUE</tt></b> or
                <b><tt>FALSE</tt></b>.
            </p></div>

            <pre class="programlisting brush: php">
$ec2_sg = new Zend_Service_Amazon_Ec2_Securitygroups(&#039;aws_key&#039;,
                                                     &#039;aws_secret_key&#039;);
$return = $ec2_sg-&gt;revokeGroup(&#039;mygroup&#039;, &#039;securityGroupName&#039;, &#039;ownerId&#039;);
</pre>

        </div>
    </div>
</div>
        <hr />

            <table width="100%">
                <tr>
                    <td width="25%" style="text-align: left;">
                    <a href="zend.service.amazon.ec2.zones.html">Zend_Service_Amazon_Ec2: Regions and Availability Zones</a>
                    </td>

                    <td width="50%" style="text-align: center;">
                        <div class="up"><span class="up"><a href="zend.service.html">Zend_Service</a></span><br />
                        <span class="home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></span></div>
                    </td>

                    <td width="25%" style="text-align: right;">
                        <div class="next" style="text-align: right; float: right;"><a href="zend.service.amazon.s3.html">Zend_Service_Amazon_S3</a></div>
                    </td>
                </tr>
            </table>
</td>
        <td style="font-size: smaller;" width="15%"> <style type="text/css">
#leftbar {
	float: left;
	width: 186px;
	padding: 5px;
	font-size: smaller;
}
ul.toc {
	margin: 0px 5px 5px 5px;
	padding: 0px;
}
ul.toc li {
	font-size: 85%;
	margin: 1px 0 1px 1px;
	padding: 1px 0 1px 11px;
	list-style-type: none;
	background-repeat: no-repeat;
	background-position: center left;
}
ul.toc li.header {
	font-size: 115%;
	padding: 5px 0px 5px 11px;
	border-bottom: 1px solid #cccccc;
	margin-bottom: 5px;
}
ul.toc li.active {
	font-weight: bold;
}
ul.toc li a {
	text-decoration: none;
}
ul.toc li a:hover {
	text-decoration: underline;
}
</style>
 <ul class="toc">
  <li class="header home"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="manual.html">Guia de Refer&ecirc;ncia do Programador</a></li>
  <li class="header up"><a href="reference.html">Refer&ecirc;ncia do Zend Framework</a></li>
  <li class="header up"><a href="zend.service.html">Zend_Service</a></li>
  <li><a href="zend.service.introduction.html">Introdu&ccedil;&atilde;o</a></li>
  <li><a href="zend.service.akismet.html">Zend_Service_Akismet</a></li>
  <li><a href="zend.service.amazon.html">Zend_Service_Amazon</a></li>
  <li><a href="zend.service.amazon.ec2.html">Zend_Service_Amazon_Ec2</a></li>
  <li><a href="zend.service.amazon.ec2.instance.html">Zend_Service_Amazon_Ec2: Instances</a></li>
  <li><a href="zend.service.amazon.ec2.windows.instance.html">Zend_Service_Amazon_Ec2: Windows Instances</a></li>
  <li><a href="zend.service.amazon.ec2.reserved.instance.html">Zend_Service_Amazon_Ec2: Reserved Instances</a></li>
  <li><a href="zend.service.amazon.ec2.cloudwatch.html">Zend_Service_Amazon_Ec2: CloudWatch Monitoring</a></li>
  <li><a href="zend.service.amazon.ec2.images.html">Zend_Service_Amazon_Ec2: Amazon Machine Images (AMI)</a></li>
  <li><a href="zend.service.amazon.ec2.ebs.html">Zend_Service_Amazon_Ec2: Elastic Block Storage (EBS)</a></li>
  <li><a href="zend.service.amazon.ec2.elasticip.html">Zend_Service_Amazon_Ec2: Elastic IP Addresses</a></li>
  <li><a href="zend.service.amazon.ec2.keypairs.html">Zend_Service_Amazon_Ec2: Keypairs</a></li>
  <li><a href="zend.service.amazon.ec2.zones.html">Zend_Service_Amazon_Ec2: Regions and Availability Zones</a></li>
  <li class="active"><a href="zend.service.amazon.ec2.securitygroups.html">Zend_Service_Amazon_Ec2: Security Groups</a></li>
  <li><a href="zend.service.amazon.s3.html">Zend_Service_Amazon_S3</a></li>
  <li><a href="zend.service.amazon.sqs.html">Zend_Service_Amazon_Sqs</a></li>
  <li><a href="zend.service.audioscrobbler.html">Zend_Service_Audioscrobbler</a></li>
  <li><a href="zend.service.delicious.html">Zend_Service_Delicious</a></li>
  <li><a href="zend.service.developergarden.html">Zend_Service_DeveloperGarden</a></li>
  <li><a href="zend.service.ebay.html">Zend_Service_Ebay</a></li>
  <li><a href="zend.service.ebay.finding.html">Zend_Service_Ebay_Finding</a></li>
  <li><a href="zend.service.flickr.html">Zend_Service_Flickr</a></li>
  <li><a href="zend.service.livedocx.html">Zend_Service_LiveDocx</a></li>
  <li><a href="zend.service.nirvanix.html">Zend_Service_Nirvanix</a></li>
  <li><a href="zend.service.recaptcha.html">Zend_Service_ReCaptcha</a></li>
  <li><a href="zend.service.short-url.html">Zend_Service_ShortUrl</a></li>
  <li><a href="zend.service.simpy.html">Zend_Service_Simpy</a></li>
  <li><a href="zend.service.slideshare.html">Zend_Service_SlideShare</a></li>
  <li><a href="zend.service.strikeiron.html">Zend_Service_StrikeIron</a></li>
  <li><a href="zend.service.strikeiron.bundled-services.html">Zend_Service_StrikeIron: Bundled Services</a></li>
  <li><a href="zend.service.strikeiron.advanced-uses.html">Zend_Service_StrikeIron: Advanced Uses</a></li>
  <li><a href="zend.service.technorati.html">Zend_Service_Technorati</a></li>
  <li><a href="zend.service.twitter.html">Zend_Service_Twitter</a></li>
  <li><a href="zend.service.windowsazure.html">Zend_Service_WindowsAzure</a></li>
  <li><a href="zend.service.windowsazure.storage.blob.html">Zend_Service_WindowsAzure_Storage_Blob</a></li>
  <li><a href="zend.service.windowsazure.diagnostics.manager.html">Zend_Service_WindowsAzure_Diagnostics_Manager</a></li>
  <li><a href="zend.service.windowsazure.storage.queue.html">Zend_Service_WindowsAzure_Storage_Queue</a></li>
  <li><a href="zend.service.windowsazure.storage.table.html">Zend_Service_WindowsAzure_Storage_Table</a></li>
  <li><a href="zend.service.yahoo.html">Zend_Service_Yahoo</a></li>
 </ul>
 </td>
    </tr>
</table>

<script type="text/javascript" src="../js/shCore.js"></script>
<script type="text/javascript" src="../js/shAutoloader.js"></script>
<script type="text/javascript" src="../js/main.js"></script>

</body>
</html>